//
//  UIViewController1.m
//  TapController
//
//  Created by marcus on 11-10-10.
//  Copyright (c) 2011年 __MyCompanyName__. All rights reserved.
//

#import "UIViewController1.h"

#import "UIViewController5.h"

@implementation UIViewController1

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)didReceiveMemoryWarning
{
    // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];
    
    // Release any cached data, images, etc that aren't in use.
}

#pragma mark - View lifecycle

// Implement loadView to create a view hierarchy programmatically, without using a nib.
- (void)loadView
{
    [super loadView];
    [self.view setBackgroundColor:[UIColor redColor]];
    
    UIButton *leftButton = [UIButton buttonWithType:UIButtonTypeRoundedRect]; //创建圆角矩形button
    [leftButton setFrame:CGRectMake(10, 10, 40, 30)]; //设置button的frame
    [leftButton setTitle:@"Left" forState:UIControlStateNormal]; //设置button的标题
    [leftButton addTarget:self action:@selector(buttonPress:) forControlEvents:UIControlEventTouchUpInside]; //定义点击时的响应函数
    [self.view addSubview:leftButton]; //添加到view上
}
-(void)buttonPress:(id)sender
{
    UIViewController5 *vc=[[[UIViewController5 alloc] initWithNibName:nil bundle:nil] autorelease];
    [self.navigationController pushViewController:vc animated:YES];
}
/*
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad
{
    [super viewDidLoad];
}
*/
- (void)viewDidUnload
{
    [super viewDidUnload];
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    // Return YES for supported orientations
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}

@end
